from pydantic_settings import BaseSettings
from pydantic import Field
import os

class Settings(BaseSettings):
    """应用配置类"""
    
    # 应用基础配置
    APP_NAME: str = "神话学院管理系统"
    APP_VERSION: str = "2.0.0"
    
    # 日志配置
    LOGGER_NAME: str = "myth_backend"
    LOG_REQUEST_BODY: bool = True
    LOG_RESPONSE_BODY: bool = True
    
    # 数据库配置
    DATABASE_URL: str = Field(..., env="DATABASE_URL")
    
    # 服务器配置
    HOST: str = Field(default="0.0.0.0", env="HOST")
    PORT: int = Field(default=8000, env="PORT")
    RELOAD: bool = Field(default=True, env="RELOAD")

    API_V1_STR: str = Field(default="/api/v1", description="API版本1前缀")
    
    # JWT配置
    secret_key: str = Field(default="myth_backend_secret_key", env="SECRET_KEY")
    access_token_expire_minutes: int = Field(default=30, env="ACCESS_TOKEN_EXPIRE_MINUTES")
    
    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"

settings = Settings()